load TagBlock,ResetTabs,INDIPanes

! -------------- Start Template -----------------
GoSub INDIPanes,"Media"
GoSub ResetTabs,0

! To omit duplicates
#objeList=""
#numOBJE=@countAll.OBJE
#numRootOBJE=@count.OBJE

! --------- OBJEs -----------
cell GroupBox,local("Multimedia")
  width -1
  newline
  if OBJE is here || SOUR is here
    Gosub TagBlock,"OBJE","Multimedia"
    ShowAll SOUR,"Media"
    newline
  else
    newline -#lineSkip-3
  endif
  Show OBJE
EndGroup

! --------- Other Multimedia
if #numOBJE>#numRootOBJE
  cell GroupBox,local("Event and Attribute Multimedia")
    width -1
    newline
    #startVH=#vpos$+#hpos$
    ShowAll INDIEvents "Media"
    ShowAll INDIOrdinances "Media"
    ! RESI are in attributes, but this ShowAll gets them first to match
    ! the event and attribute pane order
    ShowAll RESI "Media"
    ShowAll INDIAttributes "Media"
    if #startVH=#vpos$+#hpos$
      newline -6
      cell static,local("None")
      sizetofit
    endif
    
    ! Check for duplcates
    Words "#numUnique",1,0,#objeList
    #dups=#numOBJE-#numUnique[0]
    if #dups>0
      newline
      if #dups=1
        cell static,local("One duplicate was skipped")
      else
        cell static,#dups&" "&local("duplicates were skipped")
      endif
      sizetofit
    endif
  EndGroup
endif

hideexcess

